package com.wenwei.adapter;

import android.content.Context;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.wenwei.parking.R;

import java.io.File;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by nidalee on 2017/9/26.
 */

public class LookSuAdapter extends RecyclerView.Adapter<LookSuAdapter.MyViewHolder> {

    private List<String> mList;

    public void setmList(List<String> list) {
        this.mList = list;
    }

    public interface CallBack {
        void onAddImg();
    }

    private CallBack mCallBack;

    public void setmCallBack(CallBack callBack) {
        this.mCallBack = callBack;
    }

    private Context mContext;

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        mContext = parent.getContext();
        return new MyViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_image, null));
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {

        Glide.with(mContext).load(mList.get(position)).into(holder.img);

    }

    @Override
    public int getItemCount() {
        return mList == null ? 0 : mList.size();
    }

    public static class MyViewHolder extends RecyclerView.ViewHolder {
        @Bind(R.id.img)
        ImageView img;
        public MyViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }


}
